#!/bin/zsh


LOOP=100
# 从外部取到循环次数
if [ $# -eq 1 ]; then
  LOOP=$1
fi
URL="http://localhost:18080/mongo/test_entity/generate"

echo "循环次数：" "$LOOP" " start"
# 循环调用
# shellcheck disable=SC2051
# shellcheck disable=SC1073
for i in {1..${LOOP}}; do
  curl -s -X GET "$URL" > /dev/null
#  curl -X GET "$URL"
  echo -e "\n--- 请求 $i 完成 ---"

#  DELAY=$(awk 'BEGIN{srand(); print 0.1+rand()*0.2}')
#  echo "等待 $DELAY 秒..."
  # shellcheck disable=SC1123
  # shellcheck disable=SC2086
#  sleep $DELAY
done

echo "循环次数：" "$LOOP" " end"